//
//  LCWVisitorTableViewController.swift
//  MyWB
//
//  Created by 李成万 on 16/6/25.
//  Copyright © 2016年 李成万. All rights reserved.
//

import UIKit

class LCWVisitorTableViewController: UITableViewController {

    
    
    var isLogin : Bool = LCWUserAccountTools.sharedTool.isLogin
    
    let visitorView = LCWVisitorView()
    override func loadView() {
        if isLogin{
            super.loadView()
            
        }else{
    
    view = visitorView
    view.backgroundColor = RGB(237, green: 237, blue: 237)
    setupNav()
    visitorView.closure = {
    self.loginBtnClick()
    
    }
        }
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        
        
    }
    
    func setupNav(){
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: UIBarButtonItemStyle.Plain, target:self , action: "loginBtnClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target:self , action: "loginBtnClick")
    }
    
    func loginBtnClick(){
        let oAuthVc = LCWOAuthWebViewControllers()
        let nav = UINavigationController(rootViewController: oAuthVc)
        
        presentViewController(nav, animated: true, completion: nil)
    }
}